package org.example.springmessage.refult;

import lombok.Data;
import org.example.springmessage.domain.User;

import java.io.Serializable;

@Data
public  class R implements Serializable {
    private Integer code;
    private String msg;
    private Object data;

    public static R ok()
    {
        R r = new R();
        r.setCode(200);
        r.setMsg("success");
        return r;
    }
    public static R ok(Object o)
    {
        R r = new R();
        r.setCode(200);
        r.setMsg("success");
        r.setData(o);
        return r;
    }
    public static R error()
    {
        R r = new R();
        r.setCode(500);
        r.setMsg("error");
        return r;
    }
    public R data(Object data)
    {
        this.setData(data);
        return this;
    }
}
